// filter-config.ts

export type BracketType = 'L' | 'Z' | 'L+Z';

export interface FilterOptionMap {
  thickness: number[];
  l1: number[];
  l2: number[];
  l3: number[];
  hole: string[];
}

export const filterOptionsMap: Record<BracketType, FilterOptionMap> = {
  L: {
    thickness: [1.0, 1.016, 1.27],
    l1: [12.7, 19.05, 22.225, 25.4, 31.75, 34.925, 38.1, 41.275],
    l2: [9.525, 12.7, 15.875, 19.05, 28.575, 31.75, 34.925, 38.1, 41.275],
    l3: [19.05],
    hole: ['2个孔', '3个孔', '4个孔'],
  },
  Z: {
    thickness: [1.0, 1.016, 1.27],
    l1: [17.78, 24.13, 36.83],
    l2: [12.7, 25.4, 38.1, 41.275],
    l3: [19.05],
    hole: ['2个孔', '3个孔', '4个孔'],
  },
  'L+Z': {
    thickness: [1.0, 1.016, 1.27],
    l1: [12.7, 17.78, 19.05, 22.225, 24.13, 25.4, 31.75, 34.925, 36.83],
    l2: [9.525, 12.7, 15.875, 19.05, 25.4, 28.575, 31.75, 34.925, 38.1, 41.275],
    l3: [19.05],
    hole: ['2个孔', '3个孔', '4个孔'],
  },
};

export const getEffectiveType = (selected: string[]): BracketType | null => {
  const hasL = selected.includes('L');
  const hasZ = selected.includes('Z');

  if (hasL && hasZ) return 'L+Z';
  if (hasL) return 'L';
  if (hasZ) return 'Z';
  return null;
};
